* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: 40% 60%;
    grid-template-columns: 40% 60%;
}

/* 状态显示区域 */
.status-area {
    grid-row: 1;
    grid-column: 1;
    padding: 20px;
    display: grid;
    grid-template-rows: 60% 20% 10%;
    flex-direction: column;
    overflow: auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    gap: 10px;
}
.state-display {
    display: grid;
    gap: 10px;
    grid-template-columns: 50% 50%;
}
.current-state, .target-state {
    display: grid;
    flex-direction: column;
    grid-template-rows: 10% 90%;
    justify-items: center;
    align-items: center;
}
.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    background-color: #ccc;
    padding: 2px;
    margin: 10px 0;
    width: 100%;
    max-width: 50%; /* 使用相对单位 */
    aspect-ratio: 1;
    box-sizing: border-box;
}
.puzzle-grid > div {
    background-color: white;  
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    width: 100%;
    height: 100%;
}

@media (max-width: 600px) {
    .puzzle-grid {
        max-width: 100%;
    }
}
.controls {
    display: grid;
    grid-template-columns: 50% 30% 20%;
}
.controls button {
    cursor: pointer;
}
.info {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-self: center;
}

/* 表区域 */
.tables-area {
    display: flex;
    flex-direction: column;
    grid-row: 1;
    grid-column: 2;
    padding: 20px;
    border-bottom: 1px solid #ccc;
    gap: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: auto;
}
.table-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.table-scroll {
    overflow-x: auto;
    white-space: nowrap;
    border: 2px solid #ccc;
    height: 100%;
    display: flex;
    flex-direction: row; 
    flex-wrap: nowrap; 
    justify-content: flex-start; 
    align-items: center;
    padding: 2px;
    gap: 4px;
}
.table-entry {
    border : 1px solid #ccc;
    display: flex;
    flex-direction: column;
    grid-template-rows: 10% 90%;
}
.state-id {
    font-size: 0.5em;
    align-self: center;
}
.matrix33 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    background-color: #ccc;
    padding: 2px;
    height: 85%;
    aspect-ratio: 1;
}
.matrix33 > div {
    background-color: white;  
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}

/* 搜索树区域 */
.tree-area {
    grid-row: 2;
    grid-column: 1 / span 2;
    padding: 20px;
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}
.mode-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
}
.tree-container {
    margin: 0;
    overflow: hidden;
    position: relative; 
}


/* 树节点样式 */
svg {
    width: 97.9vw;
    height: 57vh;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}
.node rect {
    fill: #fff;
    stroke-width: 1.5px;
    cursor: pointer;
}
.rect-type0 {
    stroke: rgb(192, 192, 192);
}
.rect-type1 {
    stroke: rgb(100, 192, 100);
}
.rect-type2 {
    stroke: rgb(64, 64, 64);
}
.rect-type3 {
    stroke: rgb(64, 140, 64);
}
.rect-type4 {
    stroke: rgb(224, 80, 80);
}
.grid line {
    stroke-width: 1px;
    cursor: pointer;
}
.line-type0 {
    stroke: rgb(192, 192, 192);
}
.line-type1 {
    stroke: rgb(100, 224, 100);
}
.line-type2 {
    stroke: rgb(32, 32, 32);
}
.line-type3 {
    stroke: rgb(80, 160, 80);
}
.line-type4 {
    stroke: rgb(224, 80, 80);
}
.grid text {
    font: 8px sans-serif;
    cursor: pointer;
}
.link {
    fill: none;
    stroke: #ccc;
    stroke-width: 1.5px;
}
